<template>
    <div class="pay">
        <uni-popup ref="popup">
            <view class="popup-content">
                <uni-load-more :status="data.status" :content-text="{
                    contentdown: '正在支付...',
                    contentrefresh: '正在支付...',
                    contentnomore: '支付成功...'
                }" />
            </view>
        </uni-popup>
    </div>
</template>
<script lang='ts' setup>
import { ref, reactive, defineExpose, defineProps } from 'vue';
import { productOrderAddApi } from "../../https/http";
const popup = ref()
const props = defineProps()
const data = reactive({
    u_id: '',
    status: 'loading'
})

const pay = async (username: string, paydata: any) => {
    data.status = 'loading'
    popup.value.open()
    if (paydata) {
        const res = await productOrderAddApi(username, paydata)
        if (res.code == 200) {
			setTimeout(()=>{
				data.status = 'no-more'
				popup.value.close()
			},3000)
        }
    }
}
const payClose = () => {
    data.status = 'no-more'
    popup.value.close()
}
defineExpose({
    pay,
    payClose
})
</script>
<style lang='scss' scoped>
.pay {
    ::v-deep.uni-load-more__text {
        color: #fff !important;
    }
}
</style>